package com.chenchao.method;

import java.util.function.Consumer;

/**
 * @encoding : UTF-8
 * @Time : 2020/12/4 16:45
 * @Author : Chen Chao
 * @File : javaSE.com.chenchao.method.Test06.java
 * @Software : IntelliJ IDEA
 * @since : 1.8
 */
public class Test06 {
    public static void main(String[] args) {
        String[] strArray = {"林青霞,30", "张曼玉,35", "王祖贤,33"};
        printInfo(strArray,s -> {
            System.out.print("姓名:"+s.split(",")[0]+"\t");
        },s -> {
            System.out.println("年龄:"+s.split(",")[1]);
        });
    }
    public static void printInfo(String[] strings ,Consumer<String> con1,Consumer<String> con2){
        for (String string : strings) {
            con1.andThen(con2).accept(string);
        }
    }
}
